import request from '@/utils/request'
import type { InsuranceCompanyBalanceSaleDto, InsuranceCompanyDto } from './types'
import type { DictionaryDto, PageDto, PageReqDto, EnumDto } from '@/api/types'


/**
 * 获取日日保/团意日保公司列表
 *
 * @returns 返回一个包含 InsuranceCompanyDto 对象数组的 Promise
 */
export function getDaliyInsuranceCompanyList(): Promise<InsuranceCompanyDto[]> {
    return request.get('/crm-prod/insur/insurComInsuranceCompany/query-daily-insurance-company')
}

/**
 * 获取长期保公司列表
 *
 * @returns 返回 InsuranceCompanyDto 数组的 Promise 对象
 */
export function getPeriodInsuranceCompanyList(): Promise<InsuranceCompanyDto[]> {
    return request.get('/crm-prod/insur/insurComInsuranceCompany/query-period-insurance-company')
}

// 获取保司方案列表
export function getPeriodCompanySolutionList(params: {
    insureCompany: string
}): Promise<DictionaryDto[]> {
    return request.get('/crm-prod/insur/insurComInsuranceCompany/query-period-company-solution', {
        params
    })
}


// 批量获取保司方案列表
export function getPeriodPlanList(params: {
    insureCompanys: string
}): Promise<(EnumDto & DictionaryDto & {
    remark?: string
    disabled?: boolean
})[]> {
    return request.get('/crm-prod/insur/insurComInsuranceCompany/query-period-plan', {
        params
    })
}

/**
 * 获取日日保/团意日保公司列表及余额状态
 *
 * @returns 返回 InsuranceCompanyBalanceSaleDto 数组的 Promise 对象
 */
export function getDaliyInsuranceCompanyBalanceList(params: PageReqDto & {
    searchText: string
    productType: number
    sortField: string
    sortType: string
}): Promise<PageDto<InsuranceCompanyBalanceSaleDto[]>> {
    return request.get('/crm-prod/crm/record/remind-insure-customer', {
        params
    })
}

/**
 * 获取当前商务长期保公司列表及余额状态
 *
 * @returns 返回 InsuranceCompanyBalanceSaleDto 数组的 Promise 对象
 */
export function getPeriodInsuranceCompanyBalanceList(params: PageReqDto & {
    searchText: string
    sortField: string
    sortType: string
}): Promise<PageDto<InsuranceCompanyBalanceSaleDto[]>> {
    return request.get('/crm-prod/crm/record/get-period-insured-customer', {
        params
    })
}


/**
 * 获取日日保/团意日保未投保公司列表
 *
 * @returns 返回 InsuranceCompanyDto 数组的 Promise 对象
 */
export function getDaliyUnInsuranceCompanyList(params: PageReqDto & {
    searchText: string
    productType: number
    sortField: string
    sortType: string
}): Promise<PageDto<InsuranceCompanyBalanceSaleDto[]>> {
    return request.get('/crm-prod/crm/record/remind-uninsure-customer', {
        params
    })
}

/**
 * 设置长期保返利
 * @param data 
 * @returns 
 */
export function updateRebateStatus(data: {
    companyId: number
    openRebate: 0 | 1
}): Promise<string> {
    return request.post('/crm-prod/insur-com-company/insur-com-company/updateRebateStatus', data)
}
